<template>
  <div class="container">
    <nav-header></nav-header>
    <!-- 面包屑 -->
    <nav-bread>
      <span>OrderSuccess</span>
    </nav-bread>
    <div class="page-title-normal">
      <h2 class="page-title-h2"><span>check out</span></h2>
    </div>
    <!-- 进度条 -->
    <div class="check-step">
      <ul>
        <li class="cur"><span>Confirm</span> address</li>
        <li class="cur"><span>View your</span> order</li>
        <li class="cur"><span>Make</span> payment</li>
        <li class="cur"><span>Order</span> confirmation</li>
      </ul>
    </div>

    <div class="order-create">
      <div class="order-create-pic"><img src="" alt=""></div>
      <div class="order-create-main">
        <h3>Congratulations! <br>Your order is under processing!</h3>
        <p>
          <span>Order ID：{{orderId}}</span>
          <span>Order total：{{orderTotal|currency('$')}}</span>
        </p>
        <div class="order-create-btn-wrap">
          <div class="btn-l-wrap">
            <router-link class="btn btn--m" to="/cart">Cart List</router-link>
          </div>
          <div class="btn-r-wrap">
            <router-link class="btn btn--m" to="/">Goods List</router-link>
          </div>
        </div>
      </div>
    </div>

    <nav-footer></nav-footer>
  </div>
</template>

<script>
import navHeader from "@/components/Header";
import navFooter from "@/components/Footer";
import navBread from "@/components/Bread";
import model from "@/components/Model";
import axios from "axios";
export default {
  data() {
    return {
      orderList: [],
      orderId: "",
      orderTotal: ""
    };
  },
  components: {
    navHeader,
    navFooter,
    navBread,
    model
  },
  mounted() {
    this.init();
  },
  methods: {
    init() {
      var orderId = this.$route.query.orderId;
      axios
        .get("/users/orderSuccess", {
          params: {
            orderId: orderId
          }
        })
        .then(response => {
          var res = response.data;
          console.log(res);
          if (res.status == 0) {
            // console.log(res);
            // this.orderList = res.result;
            // this.orderList.forEach(item => {
            //   this.orderId = item.orderId;
            //   this.orderTotal = item.orderTotal;
            // });
            this.orderId = res.result.orderId;
            this.orderTotal = res.result.orderTotal;
          }
        });
    }
  }
};
</script>

<style>
</style>
